// components/custom-tab-bar/index.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {

    },

    /**
     * 组件的初始数据
     */
    data: {
        active:0,
        list: [
          {
            "pagePath": "/pages/index/index",
            "text": "首页",
            iconPath:"wap-home",
            selectedIconPath:"wap-home"
            },
            {
              "pagePath": "/pages/nav/nav",
              "text": "导航",
              iconPath:"map-marked",
              selectedIconPath:"map-marked"
            },
            {
              "pagePath": "/pages/chat/chat",
              "text": "聊天室",
              iconPath:"chat",
              selectedIconPath:"chat"
            },
            {
              "pagePath": "/pages/raiders/raiders",
              "text": "攻略",
              iconPath:"fire",
              selectedIconPath:"fire"
            },
            {
              "pagePath": "/pages/profile/profile",
              "text": "我的",
              iconPath:"manager",
              selectedIconPath:"manager",
            }
        ]
    },

    /**
     * 组件的方法列表
     */
    methods: {
        onChange(e){
            const index = e.detail
            const url = this.data.list[e.detail].pagePath
            this.setData({
              active:index
          })
          wx.switchTab({url})
        }
    }
})
